<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .father {
            width: 400px;
            height: 400px;
            background-color: pink;
            margin: 100px;
            overflow: hidden;
            position: relative;
        }
        .son {
            width: 150px;
            height: 150px;
            background-color: purple;
            position: absolute;
            left: 10px;
            top: 10px;
        }
    </style>
</head>
<body>
   <div class="father">
       <div class="son"></div>
   </div>
   <script>
       //1.获取设置距离的文档的偏移值
       console.log($(".son").offset());
       console.log($(".son").offset().top);
       //2.获取带有父级定位的偏移值 position 如果没有父级的定位，则以文档为标准
       console.log($(".son").position());
   </script>
</body>
</html>